/**
 * 
 */
(function($) {
	$.cfg = $.cfg || {};
	
	function Search(opt) {
		var _this = this;
		this.opt = $.extend({
			source:'google',
			type: "news"
		}, opt);
		
		switch (this.opt.source) {
			case 'google':
				googleSearch(_this.opt);
				break;
		}
	}
	
	
	function googleSearch(opt){
		var opt = $.extend({
			type:'news',
			start: 1
		}, opt);
		
		var searchParams = {
			q: opt.keyword,
			v: '1.0',
			rsz: '8',
			hl: 'zh-cn',
			start: opt.start || 1
		};
		var searchUrl = "https://ajax.googleapis.com/ajax/services/search/"+ opt.type +"?"+ $.param(searchParams) + "&callback=?";
			$.getJSON(searchUrl, function(data){
				opt.callback(data);
			});
	}
	
	
	
	$.Search = Search;
	
})(jQuery);